convert nested list into a flattern list